home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / dviware / umddvi / lib / gripes.c < prev    next >
C/C++ Source or Header  |  1990-10-01  |  3KB  |  178 lines

  1. /*
  2.  * Copyright (c) 1987 University of Maryland Department of Computer Science.
  3.  * All rights reserved.  Permission to copy for any purpose is hereby granted
  4.  * so long as this copyright notice remains intact.
  5.  */
  6.  
  7. #ifndef lint
  8. static char rcsid[] = "$Header: gripes.c,v 2.3 87/06/16 18:28:25 chris Exp $";
  9. #endif
  10.  
  11. /*
  12.  * Common errors (`gripes').
  13.  */
  14.  
  15. #include <stdio.h>
  16. #include "types.h"
  17.  
  18. static char areyousure[] = "Are you sure this is a DVI file?";
  19.  
  20. extern    errno;
  21.  
  22. /*
  23.  * DVI file requests a font it never defined.
  24.  */
  25. GripeNoSuchFont(n)
  26.     i32 n;
  27. {
  28.  
  29.     error(0, 0, "DVI file wants font %ld, which it never defined", n);
  30.     error(1, 0, areyousure);
  31.     /* NOTREACHED */
  32. }
  33.  
  34. /*
  35.  * DVI file redefines a font.
  36.  */
  37. GripeFontAlreadyDefined(n)
  38.     i32 n;
  39. {
  40.  
  41.     error(0, 0, "DVI file redefines font %ld", n);
  42.     error(1, 0, areyousure);
  43.     /* NOTREACHED */
  44. }
  45.  
  46. /*
  47.  * Unexpected DVI opcode.
  48.  */
  49. GripeUnexpectedOp(s)
  50.     char *s;
  51. {
  52.  
  53.     error(0, 0, "unexpected %s", s);
  54.     error(1, 0, areyousure);
  55.     /* NOTREACHED */
  56. }
  57.  
  58. /*
  59.  * Missing DVI opcode.
  60.  */
  61. GripeMissingOp(s)
  62.     char *s;
  63. {
  64.  
  65.     error(0, 0, "missing %s", s);
  66.     error(1, 0, areyousure);
  67.     /* NOTREACHED */
  68. }
  69.  
  70. /*
  71.  * Cannot find DVI postamble.
  72.  */
  73. GripeCannotFindPostamble()
  74. {
  75.  
  76.     error(0, 0, "cannot find postamble");
  77.     error(1, 0, areyousure);
  78.     /* NOTREACHED */
  79. }
  80.  
  81. /*
  82.  * Inconsistent DVI value.
  83.  */
  84. GripeMismatchedValue(s)
  85.     char *s;
  86. {
  87.  
  88.     error(0, 0, "mismatched %s", s);
  89.     error(1, 0, areyousure);
  90.     /* NOTREACHED */
  91. }
  92.  
  93. /*
  94.  * Undefined DVI opcode.
  95.  */
  96. GripeUndefinedOp(n)
  97.     int n;
  98. {
  99.  
  100.     error(0, 0, "undefined DVI opcode %d");
  101.     error(1, 0, areyousure);
  102.     /* NOTREACHED */
  103. }
  104.  
  105. /*
  106.  * Cannot allocate memory.
  107.  */
  108. GripeOutOfMemory(n, why)
  109.     int n;
  110.     char *why;
  111. {
  112.  
  113.     error(1, errno, "ran out of memory allocating %d bytes for %s",
  114.         n, why);
  115.     /* NOTREACHED */
  116. }
  117.  
  118. /*
  119.  * Cannot get a font.
  120.  * RETURNS TO CALLER
  121.  */
  122. GripeCannotGetFont(name, mag, dsz, dev, fullname)
  123.     char *name;
  124.     i32 mag, dsz;
  125.     char *dev, *fullname;
  126. {
  127.     int e = errno;
  128.     char scale[40];
  129.  
  130.     if (mag == dsz)        /* no scaling */
  131.         scale[0] = 0;
  132.     else
  133.         (void) sprintf(scale, " scaled %d",
  134.             (int) ((double) mag / (double) dsz * 1000.0 + .5));
  135.  
  136.     error(0, e, "cannot get font %s%s", name, scale);
  137.     if (fullname)
  138.         error(0, 0, "(wanted, e.g., \"%s\")", fullname);
  139.     else {
  140.         if (dev)
  141.             error(1, 0, "(there are no fonts for the %s engine!)",
  142.                 dev);
  143.         else
  144.             error(1, 0, "(I cannot find any fonts!)");
  145.         /* NOTREACHED */
  146.     }
  147. }
  148.  
  149. /*
  150.  * Font checksums do not match.
  151.  * RETURNS TO CALLER
  152.  */
  153. GripeDifferentChecksums(font, tfmsum, fontsum)
  154.     char *font;
  155.     i32 tfmsum, fontsum;
  156. {
  157.  
  158.     error(0, 0, "\
  159. WARNING: TeX and I have different checksums for font\n\
  160. \t\"%s\"\n\
  161. \tPlease notify your TeX maintainer\n\
  162. \t(TFM checksum = 0%o, my checksum = 0%o)",
  163.         font, tfmsum, fontsum);
  164. }
  165.  
  166. /*
  167.  * A font, or several fonts, are missing, so no output.
  168.  */
  169. GripeMissingFontsPreventOutput(n)
  170.     int n;
  171. {
  172.     static char s[2] = {'s', 0};
  173.  
  174.     error(1, 0, "%d missing font%s prevent%s output (sorry)", n,
  175.         n > 1 ? s : &s[1], n == 1 ? s : &s[1]);
  176.     /* NOTREACHED */
  177. }
  178.